package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreTopic;
import com.fujitsu.nanjing.tieba.ibator.CoreTopicCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreTopicDAOImpl extends SqlMapClientDaoSupport implements CoreTopicDAO {

    public CoreTopicDAOImpl() {
        super();
    }

    public int countByExample(CoreTopicCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_topic.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreTopicCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_topic.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer topicid) {
        CoreTopic _key = new CoreTopic();
        _key.setTopicid(topicid);
        int rows = getSqlMapClientTemplate().delete("core_topic.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreTopic record) {
        getSqlMapClientTemplate().insert("core_topic.insert", record);
    }

    public void insertSelective(CoreTopic record) {
        getSqlMapClientTemplate().insert("core_topic.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreTopic> selectByExampleWithBLOBs(CoreTopicCriteria example) {
        List<CoreTopic> list = getSqlMapClientTemplate().queryForList("core_topic.selectByExampleWithBLOBs", example);
        return list;
    }

    @SuppressWarnings("unchecked")
    public List<CoreTopic> selectByExampleWithoutBLOBs(CoreTopicCriteria example) {
        List<CoreTopic> list = getSqlMapClientTemplate().queryForList("core_topic.selectByExample", example);
        return list;
    }

    public CoreTopic selectByPrimaryKey(Integer topicid) {
        CoreTopic _key = new CoreTopic();
        _key.setTopicid(topicid);
        CoreTopic record = (CoreTopic) getSqlMapClientTemplate().queryForObject("core_topic.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreTopic record, CoreTopicCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_topic.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExampleWithBLOBs(CoreTopic record, CoreTopicCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_topic.updateByExampleWithBLOBs", parms);
        return rows;
    }

    public int updateByExampleWithoutBLOBs(CoreTopic record, CoreTopicCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_topic.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreTopic record) {
        int rows = getSqlMapClientTemplate().update("core_topic.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKeyWithBLOBs(CoreTopic record) {
        int rows = getSqlMapClientTemplate().update("core_topic.updateByPrimaryKeyWithBLOBs", record);
        return rows;
    }

    public int updateByPrimaryKeyWithoutBLOBs(CoreTopic record) {
        int rows = getSqlMapClientTemplate().update("core_topic.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreTopicCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreTopicCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}